/*
 * due.c
 *
 * Created: 14/12/2013 19:38:07
 *  Author: usuario
 */ 

#include "due.h"

void DUE_setup( void )
{
	irq_initialize_vectors();
	cpu_irq_enable();
		
	sysclk_init();

	/* Ensure all priority bits are assigned as preemption priority bits. */
	NVIC_SetPriorityGrouping( 0 );

	board_init();
	
	sleepmgr_init();
	
	sleepmgr_lock_mode(SLEEPMGR_ACTIVE);
}

uint32_t millis( void )
{
	return xTaskGetTickCount() * portTICK_RATE_MS;
}

unsigned long micros(void)
{
	uint32_t timestamp;
	vTracePortGetTimeStamp(&timestamp);
	return timestamp;
}